﻿using CreateCode.Init;
using SQLHelper;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CreateCode
{
    public partial class frm_main : Form
    {
        public frm_main()
        {
            InitializeComponent();
        }

        private void frm_main_Load(object sender, EventArgs e)
        {
            // 检测数据库文件是否存在
            string dbFile = string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["DataBaseName"]);
            string str_conn = ConfigurationManager.ConnectionStrings["SQLiteDB"].ConnectionString.ToString();
            if (!string.IsNullOrWhiteSpace(str_conn)) SQLiteHelper.DataFile = str_conn;
            MessageBox.Show(str_conn);
            if (!File.Exists(dbFile))
            {
                File.Create(dbFile);
                Initialization.Init();
            }
        }
    }
}
